package com.test.realcityalfa.json.requests;

import java.util.logging.Level;
import java.util.logging.Logger;
import org.json.JSONException;
import org.json.JSONObject;

import com.test.realcityalfa.beans.BasicRequestBean;

public class AdCountRequestBuilder implements RequestBuilder{
	//private BasicRequestBean _requestData;
	private JSONObject _object;
	
	public static String AD_COUNT_METHOD = "getAdvertiseCount"; 
	
	public AdCountRequestBuilder()
	{
		//this._requestData = requestData;
		this._object = new JSONObject();
	}
	
	@Override
	public String createRequest(BasicRequestBean beanData) throws JsonRequestException
	{		
		try
		{
			fillJsonObject();
		}
		catch(Exception ex)
		{
			Logger.getLogger(AdCountRequestBuilder.class.getName()).log(Level.SEVERE, null, ex);
			throw new JsonRequestException("Error while creating JSON request " + getClass().getName(), ex);
		}
		
		System.out.println("AdCountRequestBuilder: " + this._object.toString());
		
		return this._object.toString();
	}
	
	private void fillJsonObject() throws JSONException
	{
		this._object.put("method", AdCountRequestBuilder.AD_COUNT_METHOD);		
		this._object.put(RequestBuilder.PARAMS_NAME, new JSONObject());
	}


}
